package com.autonavi.yunda.yunji.configuration;

import com.autonavi.yunda.yunji.core.engine.script.FunctionScriptClassManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author cizhong.wcs
 * @date 2022/7/20 16:01
 */
@Slf4j
@Component
public class AdminInitConfiguration implements SmartInitializingSingleton {
    @Resource
    private FunctionScriptClassManager functionScriptClassManager;

    /**
     * 项目启动后就加载自定义函数到缓存中
     */
    @Override
    public void afterSingletonsInstantiated() {
        // 将配置的函数
        log.info("checkAndRefreshFunctionScriptManager start");
        functionScriptClassManager.checkAndRefreshFunctionScriptManager();
        log.info("checkAndRefreshFunctionScriptManager end");
    }
}
